package com.example.demo.base;

import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;

public class GlobalIntentHelper {

    public static void jumpAbility(AbilitySlice context, String toAbility) {
        Intent secondIntent = new Intent();
        // 指定待启动FA的bundleName和abilityName
        Operation operation = new Intent.OperationBuilder()
                .withDeviceId("")
                .withBundleName("com.example.demo")//这个必须填包名
                .withAbilityName(toAbility)//这个必须填包名+类名
                .build();
        secondIntent.setOperation(operation);
        // 通过AbilitySlice的startAbility接口实现启动另一个页面
        context.startAbility(secondIntent);
    }
}
